import axios from 'axios'
import {defineStore} from 'pinia'
import { NewsList,NewsRes } from '../../types'
export default defineStore('newsList',{
  state() {
      return{
       date:Date.now(),
       lists:[] as NewsRes
      }
  },
  actions:{
   async getNewsList(id :number){
      const res = await axios.get<NewsList>(`http://geek.itheima.net/v1_0/articles?channel_id=${id}&timestamp=date`)
      console.log(res);
      this.lists = res.data.data.results
  
    }
  }
})